package top.kindaries.utils;

import java.io.IOException;

/**
 * 命令行操作工具类
 *
 * @author eguid
 */
public class ExecUtil {

    /**
     * 执行命令行并获取进程
     *
     * @param cmd
     * @return
     * @throws IOException
     */
    public static Process exec(String cmd) throws IOException {
        Runtime runtime = Runtime.getRuntime();
        return runtime.exec(cmd);
    }

    /**
     * 销毁进程
     *
     * @param process
     * @return
     */
    public static boolean stop(Process process) {
        if (process != null) {
            process.destroy();
            return true;
        }
        return false;
    }

}
